package demo;

import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;

//import net.omnivention.proxy.IOUtility;

public class HttpClient {


	public static void HTTPConnect() throws Exception {
		StringBuffer f = new StringBuffer("GET /aw/pics/mops/other/JE-Merch-Charity-JewelsTiara-275x73.gif HTTP/1.0\r\n");
		f.append("accept-encoding: gzip,deflate\r\n");
		f.append("proxy-connection: keep-alive\r\n");
		f.append("accept-language: en-us,en;q=0.5\r\n");
		f.append("host: pics.ebaystatic.com\r\n");
		f.append("accept-charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n");
		f
				.append("user-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.3) Gecko/20060425 SUSE/1.5.0.3-7 Firefox/1.5.0.3\r\n");
		f.append("pragma: no-cache\r\n");
		f
				.append("accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\r\n");
		f.append("keep-alive: 300\r\n");
		f.append("\r\n");

		String str = f.toString();
		System.out.println(str);
		Socket s = new Socket("pics.ebaystatic.com", 80);
		OutputStream out = s.getOutputStream();

		out.write(str.getBytes());
		out.flush();

		InputStream in = s.getInputStream();
		int a = in.available();
		System.out.println("a=" + a);
		int r;
		do {
			r = in.read();
			char c = (char) r;
			System.out.print(c);
		} while (r != -1);

		System.out.println("\ndone");
	}

	public static void main(String[] args) throws Exception {
	}
}
